package com.xb.util;

import java.util.Random;

public class RandomCodeUtil {

    /**
     * 生成验证码
     * @param num 验证码个数
     * @return 返回验证码
     */
    public static String getRandomCode(int num){
        StringBuilder sb = new StringBuilder();
        Random random = new Random();
        for (int i = 0; i < num; i++) {
            int r = random.nextInt(10);
            sb.append(r);
        }
        return sb.toString();
    }
}
